<?php
class SportsController extends Controller
{

    private $sportsService = null;

    function __construct($id) {
        parent::__construct($id);
        $this->sportsService = new SportsService();
    }    
    public function actionHowtoplay()
    {
        $result=$this->sportsService->getRecList($_GET);
        if (is_int($result)) {
            JSONHelper::echoJSON(false, $result);
        }

        
        $this->renderPartial("howtoplay",array("recitems"=>$result));
    }
    public function actionHowtoplaylistall()
    {
        $result=$this->sportsService->getList($_GET);
        if (is_int($result)) {
            JSONHelper::echoJSON(false, $result);
        }
        $this->renderPartial("howtoplaylistall",array("items"=>$result));
    }
    public function actionPlay()
    {
        $result=$this->sportsService->getDetailById($_GET);
        if (is_int($result)) {
            JSONHelper::echoJSON(false, $result);
        }
        if($result["contenttype"] == EvaluateSports::CONTENT_VIDEO){
            $this->renderPartial("play",array("item"=>$result));
        }elseif($result["contenttype"] == EvaluateSports::CONTENT_BOOK){
            $this->renderPartial("read",array("item"=>$result));
        }else{
            $this->renderPartial($result["content"],array("item"=>$result));
        }
        
    }
}